<?php


use Sc\Util\HtmlStructure\Form;
use Sc\Util\HtmlStructure\Html\Html;

Html::create('表单-条件展示型');

$form = Form::create("demo16Form")->config(['label-width' => '80px']);

$form->addFormItems(
    Form\FormItem::text('name', '姓名'),
    Form\FormItem::radio('sex', '性别')->options([
        1 => '男',
        2 =>'女'
    ])->default(1),
    Form\FormItem::select('fruit', '水果')->when('demo16Form.sex', 2)->options([
        1 => '苹果',
        2 => '香蕉',
        3 => '橘子'
    ]),
    Form\FormItem::checkbox('like', '爱好')->when('demo16Form.sex', 1)->options([
        1 => '吃饭',
        2 => '睡觉',
        3 => '打游戏'
    ]),
);


return $form->render();
